#!/usr/bin/env node


const http=require('http'),
      url=require('url'),
      name=process.argv[2];


const addr='http://www.sian.com/';
let opt=(addr)=> {
  let p=url.parse(addr);
    p.headers={
  'user-agent':'curl/7.29.0'
};
};

function get(){
  http.get(opt(addr),(res)=>{
    log(res.headers);
    if(res.stateCode>300 &&res.stateCode<400){

    }
  });
}

http.get(addr,opt,(res)=>{
  let data='';
  res.on('data',(chunk)=>data+=chunk);
  res.on('end',()=>{
    let rs=[],num=1;
    data=JSON.parse(data).items;
    data.forEach((item)=>{
      rs.push({
        num:num++,
        name:item.name,
        description:item.description
      });
    });
    console.table(rs);
  });
});
